package cn.com.nes.site.service.contract.impl;

import cn.com.nes.mybatis.agent.contract.entity.ContractType;
import cn.com.nes.mybatis.agent.contract.mapper.ContractTypeMapper;
import cn.com.nes.site.service.contract.ContractTypeService;
import cn.com.nes.site.service.contract.bo.ContractTypePageBO;
import cn.com.nes.site.service.contract.bo.ContractTypeQueryBO;
import cn.com.nes.site.service.contract.dto.ContractTypeDTO;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ContractTypeServiceImpl extends ServiceImpl<ContractTypeMapper, ContractType> implements ContractTypeService {

    @Override
    public Page<ContractTypeDTO> getContractTypePage(ContractTypePageBO contractTypePageBO) {
        Page<ContractTypeDTO> page = new Page<>(contractTypePageBO.getPageid(), contractTypePageBO.getPagesize());
        List<ContractTypeDTO> records = this.baseMapper.getContractTypePage(page, contractTypePageBO);
        page.setRecords(records);
        return page;
    }

    @Override
    public List<ContractTypeDTO> getContractTypes(ContractTypeQueryBO contractTypeQueryBO) {
        return this.baseMapper.getContractTypes(contractTypeQueryBO);
    }

    @Override
    public List<ContractTypeDTO> getContractTypesByCompanyId(String companyId) {
        ContractTypeQueryBO contractTypeQueryBO = new ContractTypeQueryBO();
        contractTypeQueryBO.setOperateUserCompanyId(companyId);
        return this.baseMapper.getContractTypes(contractTypeQueryBO);
    }

}
